Optimal. Leaf size=138 \[ \frac {2 a^3 (B+i A) \tan (c+d x)}{d}-\frac {4 a^3 (A-i B) \log (\cos (c+d x))}{d}-4 a^3 x (B+i A)+\frac {a (A-i B) (a+i a \tan (c+d x))^2}{2 d}+\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.13, antiderivative size = 138, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.156, Rules used = {3592, 3527, 3478, 3477, 3475} \[ \frac {2 a^3 (B+i A) \tan (c+d x)}{d}-\frac {4 a^3 (A-i B) \log (\cos (c+d x))}{d}-4 a^3 x (B+i A)+\frac {a (A-i B) (a+i a \tan (c+d x))^2}{2 d}+\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3477
Rule 3478
Rule 3527
Rule 3592
Rubi steps
\begin {align*} \int \tan (c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx &=-\frac {i B (a+i a \tan (c+d x))^4}{4 a d}+\int (a+i a \tan (c+d x))^3 (-B+A \tan (c+d x)) \, dx\\ &=\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d}-(i A+B) \int (a+i a \tan (c+d x))^3 \, dx\\ &=\frac {a (A-i B) (a+i a \tan (c+d x))^2}{2 d}+\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d}-(2 a (i A+B)) \int (a+i a \tan (c+d x))^2 \, dx\\ &=-4 a^3 (i A+B) x+\frac {2 a^3 (i A+B) \tan (c+d x)}{d}+\frac {a (A-i B) (a+i a \tan (c+d x))^2}{2 d}+\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d}+\left (4 a^3 (A-i B)\right ) \int \tan (c+d x) \, dx\\ &=-4 a^3 (i A+B) x-\frac {4 a^3 (A-i B) \log (\cos (c+d x))}{d}+\frac {2 a^3 (i A+B) \tan (c+d x)}{d}+\frac {a (A-i B) (a+i a \tan (c+d x))^2}{2 d}+\frac {A (a+i a \tan (c+d x))^3}{3 d}-\frac {i B (a+i a \tan (c+d x))^4}{4 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 8.10, size = 980, normalized size = 7.10 \[ \frac {x \left (-2 i A \cos ^3(c)-2 B \cos ^3(c)-8 A \sin (c) \cos ^2(c)+8 i B \sin (c) \cos ^2(c)+12 i A \sin ^2(c) \cos (c)+12 B \sin ^2(c) \cos (c)+2 i A \cos (c)+2 B \cos (c)+8 A \sin ^3(c)-8 i B \sin ^3(c)+4 A \sin (c)-4 i B \sin (c)-2 i A \sin ^3(c) \tan (c)-2 B \sin ^3(c) \tan (c)-2 i A \sin (c) \tan (c)-2 B \sin (c) \tan (c)+(A-i B) (4 \cos (3 c)-4 i \sin (3 c)) \tan (c)\right ) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos ^4(c+d x)}{(\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\left (A \cos \left (\frac {3 c}{2}\right )-i B \cos \left (\frac {3 c}{2}\right )-i A \sin \left (\frac {3 c}{2}\right )-B \sin \left (\frac {3 c}{2}\right )\right ) \left (2 i \log \left (\cos ^2(c+d x)\right ) \sin \left (\frac {3 c}{2}\right )-2 \cos \left (\frac {3 c}{2}\right ) \log \left (\cos ^2(c+d x)\right )\right ) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos ^4(c+d x)}{d (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(A-i B) (-4 i d x \cos (3 c)-4 d x \sin (3 c)) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos ^4(c+d x)}{d (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\left (\frac {1}{3} \cos (3 c)-\frac {1}{3} i \sin (3 c)\right ) (13 i A \sin (d x)+15 B \sin (d x)) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos ^3(c+d x)}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(-9 A \cos (c)+15 i B \cos (c)-2 i A \sin (c)-6 B \sin (c)) \left (\frac {1}{6} \cos (3 c)-\frac {1}{6} i \sin (3 c)\right ) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos ^2(c+d x)}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\left (\frac {1}{3} \cos (3 c)-\frac {1}{3} i \sin (3 c)\right ) (-i A \sin (d x)-3 B \sin (d x)) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x)) \cos (c+d x)}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\left (-\frac {1}{4} i B \cos (3 c)-\frac {1}{4} B \sin (3 c)\right ) (i \tan (c+d x) a+a)^3 (A+B \tan (c+d x))}{d (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.68, size = 227, normalized size = 1.64 \[ -\frac {2 \, {\left (12 \, {\left (2 \, A - 3 i \, B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (19 \, A - 23 i \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left (23 \, A - 27 i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (13 \, A - 15 i \, B\right )} a^{3} + 6 \, {\left ({\left (A - i \, B\right )} a^{3} e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, {\left (A - i \, B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, {\left (A - i \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, {\left (A - i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (A - i \, B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.67, size = 408, normalized size = 2.96 \[ -\frac {12 \, A a^{3} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 i \, B a^{3} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 48 \, A a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 48 i \, B a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 72 \, A a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 72 i \, B a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 48 \, A a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 48 i \, B a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 48 \, A a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} - 72 i \, B a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 114 \, A a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} - 138 i \, B a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 92 \, A a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} - 108 i \, B a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 12 \, A a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 i \, B a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 26 \, A a^{3} - 30 i \, B a^{3}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 195, normalized size = 1.41 \[ -\frac {i a^{3} B \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}-\frac {i a^{3} A \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 i a^{3} B \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {a^{3} B \left (\tan ^{3}\left (d x +c \right )\right )}{d}+\frac {4 i a^{3} A \tan \left (d x +c \right )}{d}-\frac {3 a^{3} A \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {4 a^{3} B \tan \left (d x +c \right )}{d}-\frac {2 i a^{3} B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {2 a^{3} A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {4 i a^{3} A \arctan \left (\tan \left (d x +c \right )\right )}{d}-\frac {4 a^{3} B \arctan \left (\tan \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 1.67, size = 116, normalized size = 0.84 \[ -\frac {3 i \, B a^{3} \tan \left (d x + c\right )^{4} - {\left (-4 i \, A - 12 \, B\right )} a^{3} \tan \left (d x + c\right )^{3} + 6 \, {\left (3 \, A - 4 i \, B\right )} a^{3} \tan \left (d x + c\right )^{2} - 12 \, {\left (d x + c\right )} {\left (-4 i \, A - 4 \, B\right )} a^{3} - 24 \, {\left (A - i \, B\right )} a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - {\left (48 i \, A + 48 \, B\right )} a^{3} \tan \left (d x + c\right )}{12 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.04, size = 176, normalized size = 1.28 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,a^3\,1{}\mathrm {i}}{2}-\frac {a^3\,\left (2\,A-B\,1{}\mathrm {i}\right )}{2}+\frac {a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,a^3\,1{}\mathrm {i}+B\,a^3+a^3\,\left (2\,A-B\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {B\,a^3}{3}+\frac {a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )}{3}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (4\,A\,a^3-B\,a^3\,4{}\mathrm {i}\right )}{d}-\frac {B\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^4\,1{}\mathrm {i}}{4\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [B] time = 1.11, size = 236, normalized size = 1.71 \[ - \frac {4 a^{3} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {26 A a^{3} - 30 i B a^{3} + \left (92 A a^{3} e^{2 i c} - 108 i B a^{3} e^{2 i c}\right ) e^{2 i d x} + \left (114 A a^{3} e^{4 i c} - 138 i B a^{3} e^{4 i c}\right ) e^{4 i d x} + \left (48 A a^{3} e^{6 i c} - 72 i B a^{3} e^{6 i c}\right ) e^{6 i d x}}{- 3 d e^{8 i c} e^{8 i d x} - 12 d e^{6 i c} e^{6 i d x} - 18 d e^{4 i c} e^{4 i d x} - 12 d e^{2 i c} e^{2 i d x} - 3 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________